﻿// <copyright file="DictionaryValueLookup.cs" company="http://www.dymetis.com">
//
// Copyright (c) 2011 Eddie Z. Lin.
//
// This source is subject to the Microsoft Public License.
// See http://www.opensource.org/licenses/ms-pl.
// All other rights reserved.
// 
// </copyright>

namespace Dymetis.Expressions
{
    using System.Collections.Generic;

    internal class DictionaryValueLookup<TValue> : IValueLookup
    {
        private readonly IDictionary<string, TValue> values;

        public DictionaryValueLookup(IDictionary<string, TValue> values)
        {
            this.values = values;
        }

        public object GetValue(string parameterName)
        {
            TValue value;
            this.values.TryGetValue(parameterName, out value);
            return value;
        }
    }
}
